package com.googlecode.curvedmetromaps.core.model.importer;

public abstract class MapParserFactory {
	public static MapParser createParser(String resource, String path) {
		String ext = path.substring(path.lastIndexOf('.') + 1);
		ext = ext.toLowerCase();

		// Determine format by file extension.
		if (ext.equals("json")) {
			return new JsonMapParser();
		} else if (ext.equals("xml")) {
			return new OsmMapParser();
		} else if (ext.equals("graphml")) {
			return new GraphmlMapParser();
		} else {
			return null;
		}
	}
}
